#ifndef utility_TimeVal_h
#define utility_TimeVal_h

#ifdef WIN32
#include <WinSock2.h>
#else
#include <sys/time.h>
#endif

namespace serika
{
	namespace ut
	{
		struct TimeVal : public timeval
		{
		public:
			TimeVal();
			TimeVal(const TimeVal& other);
			bool operator < (const TimeVal& other) const;
			bool operator == (const TimeVal& other) const;
			bool operator != (const TimeVal& other) const;
			bool operator > (const TimeVal& other) const;
			bool operator <= (const TimeVal& other) const;
			bool operator >= (const TimeVal& other) const;
			TimeVal& operator = (const TimeVal& other);
			TimeVal operator - (const TimeVal& other) const;
			TimeVal operator + (const TimeVal& other) const;
			TimeVal& operator -= (const TimeVal& other);
			TimeVal& operator += (const TimeVal& other);
	
			double ToSeconds() const;
			void Reload();
	
			static const TimeVal& Now();
	
		private:
			inline void Normalize();
		};
	}
}

#endif
